package DMSXL._2023Before.HashTable;
/*
import java.util.HashMap;
import java.util.HashSet;

public class intersection_ {
    public static void main(String[] args) {
        int[] nums1 = {4,9,5};
        int[] nums2 = {9,4,9,8,4};
        Solution solution = new Solution();
        int[] same = solution.intersection(nums1,nums2);

        for (int i = 0; i < same.length; i++) {
            System.out.println(same[i]);
        }
    }
}

class Solution {
    public int[] intersection(int[] nums1, int[] nums2) {
        HashSet<Integer> ints = new HashSet<Integer>();
        HashSet<Integer> same = new HashSet<Integer>();
        for (int i = 0; i < nums1.length; i++) {
            ints.add(nums1[i]);
        }
        for (int i = 0; i < nums2.length; i++) {
            if(ints.contains(nums2[i])){
                same.add(nums2[i]);
            }
        }

        int[] array = new int[same.size()];
        int index = 0;
        for (Integer integer : same) {

            array[index++] = integer;
        }

        return array;
    }
}

 */